[mirrors]
http://ftp.gnome.org/pub/GNOME/sources/evince/2.32/evince-2.32.0.tar.gz

[vars]
filesize=3523623
sha512=ec43243e5b487d3101f6906bb156ed64c0b9778c13a50257602286df1b581340470558c2d8ab9078977c79cb2ebbb6f744fb411eb0faab74950da4f3d738d730

[deps]
gtk+2
glib
poppler-data
poppler
gnome-icon-theme-fake
shared-mime-info
libsm

[deps.host]
glib

[build]
# https://bugzilla.gnome.org/show_bug.cgi?id=637055
patch -p1 < "$K"/evince-scroll.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=638312
patch -p1 < "$K"/evince-quit-crash.patch
patch -p1 < "$K"/evince-segfault.patch
patch -p1 < "$K"/evince-segfault2.patch

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/') \
  --with-sysroot=$butch_root_dir"

CPPFLAGS="-D_GNU_SOURCE" CFLAGS="$optcflags" CXXFLAGS="$optcflags" \
LDFLAGS="$optldflags -Wl,-rpath-link=$butch_root_dir$butch_prefix/lib" \
./configure -C --prefix="$butch_prefix" $xconfflags \
--without-keyring \
--without-gconf \
--without-gtk-unix-print \
--with-gnu-ld \
--with-pic=yes \
--disable-help \
--disable-dbus \
--disable-nls \
--disable-gtk-doc \
--disable-gtk-doc-html \
--disable-gtk-doc-pdf \
--disable-nautilus \
--disable-thumbnailer \
--disable-previewer \
--disable-silent-rules \


[ -n "$CROSS_COMPILE" ] && "$K"/libtool.cross.gen --sysroot="$butch_root_dir"

printf '#define HAVE_POPPLER_DOCUMENT_IS_LINEARIZED\n' >> config.h

for i in po ; do
	printf 'all:\n\ttrue\ninstall:\n\ttrue\nclean:\n\ttrue\n' > "$i"/Makefile
done


make -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

# evince uses some braindamaged "GSettings schemas"
# without compiling this stuff, it won't even start up
# GSETTINGS_BACKEND=keyfile env var may be needed to save settings

glib-compile-schemas "$butch_install_dir""$butch_prefix"/share/glib-2.0/schemas
